Analiza dostępnych danych wymagała kilku czynności, których wykonanie miało wpływ na ostateczne wyniki. Należało wybrać odpowiedni sposób uzupełniania brakujących wartości, by mozliwe było dokonanie regresji. Ze względu na to, że część cech była mocno skorelowana z datą obserwacji po kilku próbach wybrano uzupełnianie brakujących wartości przez wartość minimalną, co pozytywnie wpłynęło na wyniki regresji. Niezbędnym było również wstępne wybranie statystyk, które należy przeanalizować, z powodu ich dużej ilości. Najpierw odrzucono te statystyki które miały więcej niż połowę brakujących wartości. Następnie wybrano te najbardziej wpływające na cenę złota. Po sprawdzeniu korelacji okazało się, że na cenę złota w dużej mierze wpływa stan gospodarki - wskaźniki takie jak CPI (Consumer Price Index), S&P composite, czy Dividend. Stan rozwoju świata - liczba ludności, zmniejszający się przyrost naturalny w wielu krajach, czy edukacja również mają duży wpływ na ceny złota. Zarówno PKB na osobę, jak i PKB kraju wiąże się ze zwiększeniem wartości złota. Pokazano również, że dla poszczególnych krajów wiele czynników rozwoju koreluje ze sobą, mając wpływ na GDP (PKB) danego kraju. Przy interpretacji danych należy pamiętać jednak, że część może być przyczyną, a część skutkiem rozwoju. Zwiększająca się ilość CO2 nie jest przyczyną lecz skutkiem zmian. To wszystko spowodowało, że mając dane na temat rozwoju państw i/lub gospodarki częściowo przewidzieć ceny złota, jednak należy pamiętać, że na rzeczywistość będą zawsze wpływać czynniki, które przewidzieć dużo trudniej np. kryzysy, pandemie, wojny.
r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)
install.packages("readxl")
install.packages("corrplot")
## package 'corrplot' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\anna\AppData\Local\Temp\RtmpuAZjw9\downloaded_packages
install.packages("plotly")
## package 'plotly' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\anna\AppData\Local\Temp\RtmpuAZjw9\downloaded_packages
install.packages("heatmaply")
## package 'heatmaply' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\anna\AppData\Local\Temp\RtmpuAZjw9\downloaded_packages
install.packages("arm")
## package 'arm' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\anna\AppData\Local\Temp\RtmpuAZjw9\downloaded_packages
library("readxl")
library(dplyr)
library(tidyr)
library(ggplot2)
library(mlbench)
library(corrplot)
library(caret)
library(plotly)
library(heatmaply)
library(arm)
Ścieżka do folderu z danymi
dataDirectoryPath <- 'C:/Users/anna/OneDrive/Nauka/II semestr II stopień/Zaawansowana Eksploracja Danych/Data pack/Data pack/'
Wczytanie pliku CurrencyExchangeRates.csv
currencyExchangeRatesPath <- paste0(dataDirectoryPath, 'CurrencyExchangeRates.csv')
currencyExchangeRates <- read.csv(currencyExchangeRatesPath)
Wczytanie pliku Gold prices.csv
goldPricesPath <- paste0(dataDirectoryPath, 'Gold prices.csv')
goldPrices <- read.csv(goldPricesPath)
Wczytanie pliku S&P Composite.csv
spCompositePath <- paste0(dataDirectoryPath, 'S&P Composite.csv')
spComposite <- read.csv(spCompositePath)
Wczytanie pliku World_Development_Indicators.xlsx
worldDevelopmentIndicatorsPath <- paste0(dataDirectoryPath, 'World_Development_Indicators.xlsx')
worldDevelopmentIndicators <- read_excel(worldDevelopmentIndicatorsPath)
cleanedWorldDevelopmentIndicators <- worldDevelopmentIndicators[c(1:42600, 43666:43878),]
cleanedWorldDevelopmentIndicators <- cleanedWorldDevelopmentIndicators %>%
mutate_at(vars(!c('Country Name', 'Country Code', 'Series Name', 'Series Code')), as.numeric) %>%
pivot_longer(!c('Country Name', 'Country Code', 'Series Name', 'Series Code'), names_to = "year", values_to="value")
cleanedWorldDevelopmentIndicators$year <- substr(cleanedWorldDevelopmentIndicators$year,1,4)
cleanedWorldDevelopmentIndicatorsResult <- cleanedWorldDevelopmentIndicators %>%
pivot_wider(names_from = c('Series Name', 'Series Code'), values_from = 'value', names_glue = "{`Series Name`}") %>%
mutate_at(vars(year), as.numeric)
cleanedWorldDevelopmentIndicatorsResult[cleanedWorldDevelopmentIndicatorsResult == ".." | cleanedWorldDevelopmentIndicatorsResult == ""] <- NA
cleanedWorldDevelopmentIndicatorsResult <- cleanedWorldDevelopmentIndicatorsResult %>%
select_if(colSums(!is.na(.)) > (nrow(cleanedWorldDevelopmentIndicatorsResult)/2))
n <- ncol(cleanedWorldDevelopmentIndicatorsResult)
missingValuesByCountry <- cleanedWorldDevelopmentIndicatorsResult %>%
group_by(`Country Name`) %>%
summarise_all(~sum(is.na(.))) %>%
transmute(`Country Name`, sumNA = rowSums(.[-1])) %>%
arrange(desc(sumNA))
knitr::kable(head(missingValuesByCountry, 20))
| Country Name | sumNA |
|---|---|
| Isle of Man | 4544 |
| Sint Maarten (Dutch part) | 4487 |
| Monaco | 4432 |
| American Samoa | 4389 |
| San Marino | 4378 |
| British Virgin Islands | 4318 |
| Turks and Caicos Islands | 4207 |
| Channel Islands | 4164 |
| Cayman Islands | 4127 |
| Kosovo | 4113 |
| Liechtenstein | 4026 |
| Guam | 3826 |
| Gibraltar | 3809 |
| Andorra | 3789 |
| Virgin Islands (U.S.) | 3781 |
| Faroe Islands | 3656 |
| South Sudan | 3576 |
| Tuvalu | 3568 |
| Curacao | 3556 |
| Greenland | 3556 |
worldIndicatorsComplementedDf <- cleanedWorldDevelopmentIndicatorsResult %>%
group_by(`Country Name`) %>%
mutate_each(funs(replace(., which(is.na(.)), min(., na.rm=TRUE)))) %>%
mutate_each(funs(replace(., which(is.infinite(.)), 0)))
names(worldIndicatorsComplementedDf) <- gsub(" ", "_", names(worldIndicatorsComplementedDf))
names(cleanedWorldDevelopmentIndicatorsResult) <- gsub(" ", "_", names(cleanedWorldDevelopmentIndicatorsResult))
worldIndicatorsComplementedDf <- worldIndicatorsComplementedDf %>%
rename(CO2_emissions_residential_buildings_and_services = `CO2_emissions_from_residential_buildings_and_commercial_and_public_services_(%_of_total_fuel_combustion)`) %>%
rename(CO2_emissions_from_other_sectors = `CO2_emissions_from_other_sectors,_excluding_residential_buildings_and_commercial_and_public_services_(%_of_total_fuel_combustion)`)
knitr::kable(head(worldIndicatorsComplementedDf))
| Country_Name | Country_Code | year | Urban_population_growth_(annual_%) | Urban_population_(%_of_total_population) | Urban_population | Transport_services_(%_of_commercial_service_exports) | Transport_services_(%_of_commercial_service_imports) | Trade_in_services_(%_of_GDP) | Trade_(%_of_GDP) | Total_natural_resources_rents_(%_of_GDP) | Total_greenhouse_gas_emissions_(kt_of_CO2_equivalent) | Taxes_less_subsidies_on_products_(current_US\()| Taxes_less_subsidies_on_products_(current_LCU)| Taxes_less_subsidies_on_products_(constant_LCU)| Survival_to_age_65,_female_(%_of_cohort)| Survival_to_age_65,_male_(%_of_cohort)| Services,_value_added_(%_of_GDP)| Service_imports_(BoP,_current_US\)) | Service_exports_(BoP,_current_US\()| Secondary_education,_pupils| Rural_population_growth_(annual_%)| Rural_population_(%_of_total_population)| Rural_population| Renewable_energy_consumption_(%_of_total_final_energy_consumption)| Renewable_electricity_output_(%_of_total_electricity_output)| Pupil-teacher_ratio,_primary| Primary_income_payments_(BoP,_current_US\)) | Primary_income_receipts_(BoP,_current_US\()| Primary_school_starting_age_(years)| Portfolio_investment,_net_(BoP,_current_US\)) | Portfolio_equity,net_inflows(BoP,_current_US\()| Population,_total| Population,_male| Population,_male_(%_of_total_population)| Population,_female_(%_of_total_population)| Population,_female| Population_in_urban_agglomerations_of_more_than_1_million| Population_in_the_largest_city_(%_of_urban_population)| Population_in_largest_city| Population_growth_(annual_%)| Population_density_(people_per_sq._km_of_land_area)| Population_ages_65_and_above_(%_of_total_population)| Population_ages_15-64_(%_of_total_population)| Population_ages_0-14_(%_of_total_population)| Number_of_under-five_deaths| Nitrous_oxide_emissions_(thousand_metric_tons_of_CO2_equivalent)| Nitrous_oxide_emissions_in_energy_sector_(%_of_total)| Net_primary_income_(Net_income_from_abroad)_(current_US\)) | Net_primary_income_(Net_income_from_abroad)_(current_LCU) | Net_primary_income_(BoP,_current_US\()| Net_official_development_assistance_received_(current_US\)) | Net_domestic_credit_(current_LCU) | Natural_gas_rents_(%_of_GDP) | Mortality_rate,infant(per_1,000_live_births) | Methane_emissions_(kt_of_CO2_equivalent) | Methane_emissions_in_energy_sector_(thousand_metric_tons_of_CO2_equivalent) | Merchandise_exports_to_high-income_economies_(%_of_total_merchandise_exports) | Manufacturing,value_added(%_of_GDP) | Life_expectancy_at_birth,total(years) | Land_area_(sq._km) | Labor_force,_total | Inflation,consumer_prices(annual_%) | Individuals_using_the_Internet_(%_of_population) | Imports_of_goods_and_services_(current_US\()| Imports_of_goods_and_services_(%_of_GDP)| Gross_savings_(%_of_GDP)| Gross_national_expenditure_(%_of_GDP)| Gross_national_expenditure_(current_US\)) | Gross_savings_(current_US\()| Gross_domestic_savings_(%_of_GDP)| Gross_domestic_savings_(current_US\)) | Goods_exports_(BoP,_current_US\()| Goods_imports_(BoP,_current_US\)) | GDP_per_capita_(current_US\()| GDP_per_capita_growth_(annual_%)| GDP_growth_(annual_%)| GDP_(current_US\)) | Fuel_exports_(%_of_merchandise_exports) | Fuel_imports_(%_of_merchandise_imports) | Food_exports_(%_of_merchandise_exports) | Food_imports_(%_of_merchandise_imports) | Exports_of_goods_and_services_(current_US\()| Exports_of_goods_and_services_(annual_%_growth)| Electricity_production_from_renewable_sources,_excluding_hydroelectric_(kWh)| Electricity_production_from_renewable_sources,_excluding_hydroelectric_(%_of_total)| Electricity_production_from_oil,_gas_and_coal_sources_(%_of_total)| Electricity_production_from_coal_sources_(%_of_total)| Electricity_production_from_hydroelectric_sources_(%_of_total)| Electricity_production_from_natural_gas_sources_(%_of_total)| Electricity_production_from_nuclear_sources_(%_of_total)| Consumer_price_index_(2010_=_100)| CO2_emissions_from_solid_fuel_consumption_(%_of_total)| CO2_emissions_from_solid_fuel_consumption_(kt)| CO2_emissions_from_transport_(%_of_total_fuel_combustion)| CO2_intensity_(kg_per_kg_of_oil_equivalent_energy_use)| CO2_emissions_residential_buildings_and_services| CO2_emissions_from_other_sectors| CO2_emissions_from_manufacturing_industries_and_construction_(%_of_total_fuel_combustion)| CO2_emissions_from_liquid_fuel_consumption_(kt)| CO2_emissions_from_liquid_fuel_consumption_(%_of_total)| CO2_emissions_from_gaseous_fuel_consumption_(kt)| CO2_emissions_from_gaseous_fuel_consumption_(%_of_total)| CO2_emissions_from_electricity_and_heat_production,_total_(%_of_total_fuel_combustion)| CO2_emissions_(metric_tons_per_capita)| CO2_emissions_(kt)| CO2_emissions_(kg_per_2010_US\)_of_GDP) | Birth_rate,crude(per_1,000_people) | Access_to_electricity_(%_of_population) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Afghanistan | AFG | 1970 | 5.748488 | 11.643 | 1300949 | 6.982691 | 59.19951 | 4.926239 | 21.72811 | 0.3028816 | 14306.62 | 60000000 | 2700000000 | 7606457000 | 27.72562 | 23.52467 | 36.15115 | 103400000 | 8200000 | 116174 | 2.121114 | 88.357 | 9872705 | 11.5591 | 67.7305 | 41.22332 | 6900000 | 19200000 | 7 | -29571652 | 0 | 11173654 | 5697024 | 50.98622 | 49.01378 | 5476630 | 471891 | 36.27283 | 471891 | 2.536744 | 17.11493 | 2.631613 | 53.04314 | 44.32524 | 164463 | 3042.256 | 4.823610 | 35557778 | 1600100000 | -35470046 | 27610001 | 10711736612 | 0.0000000 | 200.9 | 10202.00 | 1166.628 | 33.71281 | 3.530422 | 37.409 | 652860 | 3066275 | -6.811161 | 0 | 208888900 | 11.94411 | 0 | 102.1601 | 1786664529 | 0 | 3.303681 | 57777629 | 252300000 | 623500000 | 156.5188 | -4.168191 | -1.934778 | 1748886596 | 16.94615 | 6.105695 | 36.06465 | 20.54160 | 171111104 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 63.52339 | 26.09649 | 436.373 | 0 | 0 | 0 | 0 | 0 | 671.061 | 40.13158 | 216.353 | 12.93860 | 0 | 0.1496513 | 1672.152 | 0.1371468 | 51.502 | 22.29527 |
| Afghanistan | AFG | 1971 | 5.860102 | 12.021 | 1379464 | 6.982691 | 59.19951 | 4.926239 | 27.06314 | 0.3739563 | 14391.78 | 64444444 | 2900000000 | 7606457000 | 28.39374 | 24.14596 | 36.15115 | 103400000 | 8200000 | 134069 | 2.236404 | 87.979 | 10095986 | 11.5591 | 67.7305 | 39.10539 | 6900000 | 19200000 | 7 | -29571652 | 0 | 11475450 | 5845351 | 50.93788 | 49.06212 | 5630099 | 495303 | 35.90547 | 495303 | 2.665128 | 17.57720 | 2.635235 | 52.69327 | 44.67150 | 165306 | 3006.138 | 4.863614 | 37777778 | 1700000000 | -35470046 | 44439999 | 11670336612 | 0.0000000 | 197.1 | 10201.50 | 1178.829 | 42.71271 | 3.530422 | 37.930 | 652860 | 3066275 | -6.811161 | 0 | 295555549 | 16.14080 | 0 | 105.2184 | 1926664351 | 0 | 0.242728 | 4444613 | 252300000 | 623500000 | 159.5675 | -4.168191 | -1.934778 | 1831108971 | 14.55330 | 5.000146 | 27.02128 | 25.43237 | 199999989 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 63.52339 | 18.95551 | 359.366 | 0 | 0 | 0 | 0 | 0 | 748.068 | 39.45841 | 440.040 | 23.21083 | 0 | 0.1652082 | 1895.839 | 0.1371468 | 51.411 | 22.29527 |
| Afghanistan | AFG | 1972 | 5.899299 | 12.410 | 1463291 | 6.982691 | 59.19951 | 4.926239 | 32.86908 | 0.4352624 | 13040.85 | 60000000 | 2700000000 | 7606457000 | 29.06186 | 24.76724 | 36.15115 | 103400000 | 8200000 | 153060 | 2.271405 | 87.590 | 10327931 | 11.5591 | 67.7305 | 40.38314 | 6900000 | 19200000 | 7 | -29571652 | 0 | 11791222 | 6000895 | 50.89290 | 49.10710 | 5790327 | 528508 | 36.11776 | 528508 | 2.714539 | 18.06087 | 2.627456 | 52.43530 | 44.93724 | 166120 | 2530.158 | 5.652229 | 35553333 | 1599900000 | -35470046 | 55180000 | 13556437512 | 0.0041971 | 193.4 | 9170.59 | 1262.196 | 35.24140 | 3.530422 | 38.461 | 652860 | 3066275 | -6.811161 | 0 | 288888878 | 18.10585 | 0 | 103.3426 | 1648888947 | 0 | 3.203335 | 51110980 | 252300000 | 623500000 | 135.3172 | -4.168191 | -1.934778 | 1595555476 | 13.73092 | 6.813822 | 37.23807 | 28.46417 | 235555544 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 63.52339 | 12.44019 | 190.684 | 0 | 0 | 0 | 0 | 0 | 627.057 | 40.90909 | 300.694 | 19.61722 | 0 | 0.1299955 | 1532.806 | 0.1371468 | 51.303 | 22.29527 |
| Afghanistan | AFG | 1973 | 5.823573 | 12.809 | 1551037 | 6.982691 | 59.19951 | 4.926239 | 27.69231 | 0.8714832 | 13535.75 | 64444444 | 2900000000 | 7606457000 | 29.83817 | 25.49372 | 36.15115 | 103400000 | 8200000 | 165346 | 2.202488 | 87.191 | 10557926 | 11.5591 | 67.7305 | 38.32161 | 6900000 | 19200000 | 7 | -29571652 | 0 | 12108963 | 6157843 | 50.85359 | 49.14641 | 5951120 | 573161 | 36.95341 | 573161 | 2.659057 | 18.54756 | 2.609505 | 52.25243 | 45.13807 | 166562 | 2674.404 | 5.255055 | 37775556 | 1699900000 | -35470046 | 55720001 | 13941837512 | 0.0479294 | 189.4 | 9403.54 | 1173.216 | 29.77436 | 3.530422 | 39.003 | 652860 | 3066275 | -6.811161 | 0 | 255555562 | 14.74359 | 0 | 101.7949 | 1764444431 | 0 | 5.512817 | 95555493 | 252300000 | 623500000 | 143.1446 | -4.168191 | -1.934778 | 1733333264 | 11.61954 | 6.565215 | 48.62099 | 23.86529 | 224444438 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 63.52339 | 19.01566 | 311.695 | 0 | 0 | 0 | 0 | 0 | 704.064 | 42.95302 | 333.697 | 20.35794 | 0 | 0.1353666 | 1639.149 | 0.1371468 | 51.184 | 22.29527 |
| Afghanistan | AFG | 1974 | 5.630224 | 13.219 | 1640869 | 6.982691 | 59.19951 | 4.926239 | 28.86598 | 1.1527195 | 14945.97 | 120000000 | 5400000000 | 7606457000 | 30.61448 | 26.22020 | 36.15115 | 103400000 | 8200000 | 172797 | 2.008176 | 86.781 | 10772091 | 11.5591 | 67.7305 | 37.21537 | 6900000 | 19200000 | 7 | -29571652 | 0 | 12412960 | 6308583 | 50.82255 | 49.17745 | 6104377 | 621656 | 37.88578 | 621656 | 2.479517 | 19.01320 | 2.583512 | 52.13682 | 45.27967 | 166690 | 2937.318 | 5.028316 | 46666667 | 2100000000 | -35470046 | 48910000 | 15681237512 | 0.1701138 | 185.5 | 9987.93 | 1304.340 | 24.15658 | 3.530422 | 39.558 | 652860 | 3066275 | -6.811161 | 0 | 320000000 | 14.84536 | 0 | 100.8247 | 2173333344 | 0 | 7.938141 | 171111036 | 252300000 | 623500000 | 173.6536 | -4.168191 | -1.934778 | 2155555498 | 13.97424 | 9.325608 | 43.91324 | 22.88171 | 302222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 63.52339 | 15.86998 | 304.361 | 0 | 0 | 0 | 0 | 0 | 770.070 | 40.15296 | 399.703 | 20.84130 | 0 | 0.1545031 | 1917.841 | 0.1371468 | 51.058 | 22.29527 |
| Afghanistan | AFG | 1975 | 5.343228 | 13.641 | 1730929 | 6.982691 | 59.19951 | 4.926239 | 26.94836 | 1.6405264 | 14574.16 | 91111111 | 4100000000 | 7606457000 | 31.39079 | 26.94668 | 36.15115 | 103400000 | 8200000 | 185723 | 1.713261 | 86.359 | 10958235 | 11.5591 | 67.7305 | 37.30693 | 6900000 | 19200000 | 7 | -29571652 | 0 | 12689164 | 6446273 | 50.80140 | 49.19860 | 6242891 | 674254 | 38.95330 | 674254 | 2.200731 | 19.43627 | 2.551445 | 52.09805 | 45.35050 | 166442 | 3153.723 | 4.835251 | 51111111 | 2300000000 | -35470046 | 66980003 | 15551937512 | 0.4362939 | 181.5 | 10476.60 | 1298.326 | 29.40127 | 3.530422 | 40.128 | 652860 | 3066275 | -6.811161 | 0 | 337777778 | 14.27230 | 0 | 101.5962 | 2404444524 | 0 | 8.169009 | 193333202 | 252300000 | 623500000 | 186.5108 | -4.168191 | -1.934778 | 2366666616 | 20.29962 | 7.743069 | 36.42858 | 24.42357 | 300000007 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 63.52339 | 18.79310 | 399.703 | 0 | 0 | 0 | 0 | 0 | 876.413 | 41.20690 | 476.710 | 22.41379 | 0 | 0.1676123 | 2126.860 | 0.1371468 | 50.930 | 22.29527 |
goldPricesYearly <- goldPrices
goldPricesYearly$year <- substr(goldPrices$Date,1,4)
goldPricesYearly <- group_by(goldPricesYearly, year)
goldPricesYearly <- summarize(goldPricesYearly,
gold_usd = mean(`USD..AM.`, na.rm=TRUE),
gold_gbp = mean(`GBP..AM.`, na.rm=TRUE),
gold_euro = mean(`EURO..AM.`, na.rm=TRUE))
knitr::kable(head(goldPricesYearly))
| year | gold_usd | gold_gbp | gold_euro |
|---|---|---|---|
| 1968 | 38.82947 | 16.21790 | NaN |
| 1969 | 41.09988 | 17.19545 | NaN |
| 1970 | 35.96369 | 15.01211 | NaN |
| 1971 | 40.80680 | 16.67321 | NaN |
| 1972 | 58.17378 | 23.37925 | NaN |
| 1973 | 97.11735 | 39.54271 | NaN |
spCompositeYearly <- spComposite
spCompositeYearly$year <- substr(spComposite$Year,1,4)
spCompositeYearly <- group_by(spCompositeYearly, year)
spCompositeYearly <- summarize(spCompositeYearly,
spComposite = mean(`S.P.Composite`, na.rm=TRUE),
dividend = mean(Dividend, na.rm=TRUE),
earnings = mean(Earnings, na.rm=TRUE),
cpi = mean(CPI, na.rm=TRUE),
longInterestRate = mean(`Long.Interest.Rate`, na.rm=TRUE),
realPrice = mean(`Real.Price`, na.rm=TRUE),
realDividend = mean(`Real.Dividend`, na.rm=TRUE),
realEarnings = mean(`Real.Earnings`, na.rm=TRUE),
cyclicallyAdjustedPERattio = mean(`Cyclically.Adjusted.PE.Ratio`,na.rm=TRUE),
)
knitr::kable(head(spCompositeYearly))
| year | spComposite | dividend | earnings | cpi | longInterestRate | realPrice | realDividend | realEarnings | cyclicallyAdjustedPERattio |
|---|---|---|---|---|---|---|---|---|---|
| 1871 | 4.691667 | 0.2600000 | 0.4000000 | 12.40064 | 5.338333 | 103.3978 | 5.727707 | 8.811857 | NaN |
| 1872 | 5.029167 | 0.2816667 | 0.4162500 | 12.92396 | 5.460833 | 106.2341 | 5.949608 | 8.793324 | NaN |
| 1873 | 4.801667 | 0.3162500 | 0.4462500 | 12.67816 | 5.529583 | 103.2745 | 6.823079 | 9.625514 | NaN |
| 1874 | 4.570000 | 0.3300000 | 0.4600000 | 11.94077 | 5.286667 | 104.5140 | 7.549957 | 10.524182 | NaN |
| 1875 | 4.447500 | 0.3137500 | 0.4058333 | 11.26684 | 4.850000 | 107.7608 | 7.601466 | 9.825189 | NaN |
| 1876 | 4.060833 | 0.3000000 | 0.3166667 | 10.50566 | 4.525833 | 105.5173 | 7.801827 | 8.229060 | NaN |
Podsumowanie WorldDevelopmentIndicators
knitr::kable(summary(cleanedWorldDevelopmentIndicatorsResult))
| Country_Name | Country_Code | year | Urban_population_growth_(annual_%) | Urban_population_(%_of_total_population) | Urban_population | Transport_services_(%_of_commercial_service_exports) | Transport_services_(%_of_commercial_service_imports) | Trade_in_services_(%_of_GDP) | Trade_(%_of_GDP) | Total_natural_resources_rents_(%_of_GDP) | Total_greenhouse_gas_emissions_(kt_of_CO2_equivalent) | Taxes_less_subsidies_on_products_(current_US\() |Taxes_less_subsidies_on_products_(current_LCU) |Taxes_less_subsidies_on_products_(constant_LCU) |Survival_to_age_65,_female_(%_of_cohort) |Survival_to_age_65,_male_(%_of_cohort) |Services,_value_added_(%_of_GDP) |Service_imports_(BoP,_current_US\)) | Service_exports_(BoP,_current_US\() |Secondary_education,_pupils |Rural_population_growth_(annual_%) |Rural_population_(%_of_total_population) |Rural_population |Renewable_energy_consumption_(%_of_total_final_energy_consumption) |Renewable_electricity_output_(%_of_total_electricity_output) |Pupil-teacher_ratio,_primary |Primary_income_payments_(BoP,_current_US\)) | Primary_income_receipts_(BoP,_current_US\() |Primary_school_starting_age_(years) |Portfolio_investment,_net_(BoP,_current_US\)) | Portfolio_equity,net_inflows(BoP,_current_US\() |Population,_total |Population,_male |Population,_male_(%_of_total_population) |Population,_female_(%_of_total_population) |Population,_female |Population_in_urban_agglomerations_of_more_than_1_million |Population_in_the_largest_city_(%_of_urban_population) |Population_in_largest_city |Population_growth_(annual_%) |Population_density_(people_per_sq._km_of_land_area) |Population_ages_65_and_above_(%_of_total_population) |Population_ages_15-64_(%_of_total_population) |Population_ages_0-14_(%_of_total_population) |Number_of_under-five_deaths |Nitrous_oxide_emissions_(thousand_metric_tons_of_CO2_equivalent) |Nitrous_oxide_emissions_in_energy_sector_(%_of_total) |Net_primary_income_(Net_income_from_abroad)_(current_US\)) | Net_primary_income_(Net_income_from_abroad)_(current_LCU) | Net_primary_income_(BoP,_current_US\() |Net_official_development_assistance_received_(current_US\)) | Net_domestic_credit_(current_LCU) | Natural_gas_rents_(%_of_GDP) | Mortality_rate,infant(per_1,000_live_births) | Methane_emissions_(kt_of_CO2_equivalent) | Methane_emissions_in_energy_sector_(thousand_metric_tons_of_CO2_equivalent) | Merchandise_exports_to_high-income_economies_(%_of_total_merchandise_exports) | Manufacturing,value_added(%_of_GDP) | Life_expectancy_at_birth,total(years) | Land_area_(sq._km) | Labor_force,_total | Inflation,consumer_prices(annual_%) | Individuals_using_the_Internet_(%_of_population) | Imports_of_goods_and_services_(current_US\() |Imports_of_goods_and_services_(%_of_GDP) |Gross_savings_(%_of_GDP) |Gross_national_expenditure_(%_of_GDP) |Gross_national_expenditure_(current_US\)) | Gross_savings_(current_US\() |Gross_domestic_savings_(%_of_GDP) |Gross_domestic_savings_(current_US\)) | Goods_exports_(BoP,_current_US\() |Goods_imports_(BoP,_current_US\)) | GDP_per_capita_(current_US\() |GDP_per_capita_growth_(annual_%) |GDP_growth_(annual_%) |GDP_(current_US\)) | Fuel_exports_(%_of_merchandise_exports) | Fuel_imports_(%_of_merchandise_imports) | Food_exports_(%_of_merchandise_exports) | Food_imports_(%_of_merchandise_imports) | Exports_of_goods_and_services_(current_US\() |Exports_of_goods_and_services_(annual_%_growth) |Electricity_production_from_renewable_sources,_excluding_hydroelectric_(kWh) |Electricity_production_from_renewable_sources,_excluding_hydroelectric_(%_of_total) |Electricity_production_from_oil,_gas_and_coal_sources_(%_of_total) |Electricity_production_from_coal_sources_(%_of_total) |Electricity_production_from_hydroelectric_sources_(%_of_total) |Electricity_production_from_natural_gas_sources_(%_of_total) |Electricity_production_from_nuclear_sources_(%_of_total) |Consumer_price_index_(2010_=_100) |CO2_emissions_from_solid_fuel_consumption_(%_of_total) |CO2_emissions_from_solid_fuel_consumption_(kt) |CO2_emissions_from_transport_(%_of_total_fuel_combustion) |CO2_intensity_(kg_per_kg_of_oil_equivalent_energy_use) |CO2_emissions_from_residential_buildings_and_commercial_and_public_services_(%_of_total_fuel_combustion) |CO2_emissions_from_other_sectors,_excluding_residential_buildings_and_commercial_and_public_services_(%_of_total_fuel_combustion) |CO2_emissions_from_manufacturing_industries_and_construction_(%_of_total_fuel_combustion) |CO2_emissions_from_liquid_fuel_consumption_(kt) |CO2_emissions_from_liquid_fuel_consumption_(%_of_total) |CO2_emissions_from_gaseous_fuel_consumption_(kt) |CO2_emissions_from_gaseous_fuel_consumption_(%_of_total) |CO2_emissions_from_electricity_and_heat_production,_total_(%_of_total_fuel_combustion) |CO2_emissions_(metric_tons_per_capita) |CO2_emissions_(kt) |CO2_emissions_(kg_per_2010_US\)_of_GDP) | Birth_rate,crude(per_1,000_people) | Access_to_electricity_(%_of_population) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Length:10251 | Length:10251 | Min. :1970 | Min. :-187.142 | Min. : 2.845 | Min. : 1267 | Min. :-381.37 | Min. : 0.292 | Min. : 1.165 | Min. : 0.021 | Min. : 0.0000 | Min. : 1 | Min. :-14435512683 | Min. :-125496297000000 | Min. :-98323116751800 | Min. : 6.464 | Min. : 1.477 | Min. :10.86 | Min. : 912800 | Min. : 0 | Min. : 0 | Min. :-235.7924 | Min. : 0.00 | Min. : 0 | Min. : 0.000 | Min. : 0.00 | Min. : 5.226 | Min. : -218731249 | Min. : -50607238 | Min. :4.000 | Min. :-807954000000 | Min. :-244072000000 | Min. : 5740 | Min. : 25278 | Min. :44.37 | Min. :23.29 | Min. : 25864 | Min. : 34329 | Min. : 2.867 | Min. : 18587 | Min. :-10.9551 | Min. : 0.136 | Min. : 0.6856 | Min. :45.45 | Min. :11.05 | Min. : 0 | Min. : 0.0 | Min. : 0.000 | Min. :-99049385578 | Min. :-481321056610000 | Min. :-105172643986 | Min. : -989940002 | Min. : -54237641050700 | Min. : 0.0000 | Min. : 1.50 | Min. : 0 | Min. : 0 | Min. : 0.0074 | Min. : 0.000 | Min. :18.91 | Min. : 2 | Min. : 31205 | Min. : -18.109 | Min. : 0.000 | Min. : 0 | Min. : 0.00 | Min. :-236.27 | Min. : 21.21 | Min. : 18046707 | Min. : -26010016894 | Min. :-141.97 | Min. : -7621878298 | Min. : 199074 | Min. : 5153121 | Min. : 22.8 | Min. :-64.9924 | Min. :-64.047 | Min. : 8824448 | Min. : 0.000 | Min. : 0.009 | Min. : 0.000 | Min. : 0.474 | Min. : 693281 | Min. : -96.4 | Min. : 0 | Min. : 0.000 | Min. : 0.00 | Min. : 0.000 | Min. : 0.000 | Min. : 0.000 | Min. : 0.000 | Min. : 0.00 | Min. : -4.324 | Min. : -114 | Min. : 0.00 | Min. : 0.054 | Min. : 0.000 | Min. :-2.326 | Min. : 0.00 | Min. : -161 | Min. : -6.089 | Min. : -147 | Min. : -0.7295 | Min. : 0.00 | Min. : 0.0000 | Min. : 0 | Min. :0.0000 | Min. : 5.90 | Min. : 0.534 | |
| Class :character | Class :character | 1st Qu.:1982 | 1st Qu.: 1.020 | 1st Qu.: 33.732 | 1st Qu.: 308785 | 1st Qu.: 12.50 | 1st Qu.:27.904 | 1st Qu.: 9.475 | 1st Qu.: 46.245 | 1st Qu.: 0.1967 | 1st Qu.: 7020 | 1st Qu.: 175995379 | 1st Qu.: 473000000 | 1st Qu.: 2155665300 | 1st Qu.:60.375 | 1st Qu.:51.602 | 1st Qu.:42.43 | 1st Qu.: 296306400 | 1st Qu.: 183033447 | 1st Qu.: 66416 | 1st Qu.: -0.4758 | 1st Qu.:25.78 | 1st Qu.: 233742 | 1st Qu.: 3.567 | 1st Qu.: 0.05 | 1st Qu.: 18.038 | 1st Qu.: 94167420 | 1st Qu.: 25349827 | 1st Qu.:6.000 | 1st Qu.: -109276346 | 1st Qu.: 0 | 1st Qu.: 724234 | 1st Qu.: 881327 | 1st Qu.:48.91 | 1st Qu.:49.65 | 1st Qu.: 835377 | 1st Qu.: 1078178 | 1st Qu.: 21.503 | 1st Qu.: 622567 | 1st Qu.: 0.5894 | 1st Qu.: 22.669 | 1st Qu.: 3.2186 | 1st Qu.:53.36 | 1st Qu.:23.35 | 1st Qu.: 655 | 1st Qu.: 499.6 | 1st Qu.: 2.617 | 1st Qu.: -1023369537 | 1st Qu.: -11588042500 | 1st Qu.: -1303373808 | 1st Qu.: 28555001 | 1st Qu.: 2524760134 | 1st Qu.: 0.0000 | 1st Qu.: 12.70 | 1st Qu.: 1650 | 1st Qu.: 140 | 1st Qu.: 56.0697 | 1st Qu.: 7.842 | 1st Qu.:59.16 | 1st Qu.: 13450 | 1st Qu.: 1022938 | 1st Qu.: 2.296 | 1st Qu.: 0.137 | 1st Qu.: 1228323588 | 1st Qu.: 25.09 | 1st Qu.: 14.76 | 1st Qu.: 97.69 | 1st Qu.: 4028319213 | 1st Qu.: 695514598 | 1st Qu.: 10.63 | 1st Qu.: 355315735 | 1st Qu.: 544473558 | 1st Qu.: 928350408 | 1st Qu.: 747.9 | 1st Qu.: -0.4303 | 1st Qu.: 1.169 | 1st Qu.: 2187406538 | 1st Qu.: 0.462 | 1st Qu.: 7.109 | 1st Qu.: 6.289 | 1st Qu.: 8.460 | 1st Qu.: 895671076 | 1st Qu.: -0.4 | 1st Qu.: 0 | 1st Qu.: 0.000 | 1st Qu.: 29.70 | 1st Qu.: 0.000 | 1st Qu.: 1.699 | 1st Qu.: 0.000 | 1st Qu.: 0.000 | 1st Qu.: 26.01 | 1st Qu.: 0.000 | 1st Qu.: 0 | 1st Qu.:17.75 | 1st Qu.: 1.548 | 1st Qu.: 4.651 | 1st Qu.: 0.302 | 1st Qu.:12.28 | 1st Qu.: 737 | 1st Qu.: 45.616 | 1st Qu.: 0 | 1st Qu.: 0.0000 | 1st Qu.:21.75 | 1st Qu.: 0.4834 | 1st Qu.: 1157 | 1st Qu.:0.2379 | 1st Qu.:15.00 | 1st Qu.: 71.958 | |
| Mode :character | Mode :character | Median :1995 | Median : 2.323 | Median : 53.806 | Median : 2250864 | Median : 23.42 | Median :40.922 | Median : 15.700 | Median : 69.744 | Median : 1.8564 | Median : 30890 | Median : 973745600 | Median : 7987295600 | Median : 28709021350 | Median :77.149 | Median :64.447 | Median :51.69 | Median : 1228100000 | Median : 1112061730 | Median : 395478 | Median : 0.6670 | Median :46.19 | Median : 2090364 | Median :18.187 | Median : 13.67 | Median : 25.339 | Median : 589525169 | Median : 198990841 | Median :6.000 | Median : 0 | Median : 0 | Median : 4999443 | Median : 3041474 | Median :49.65 | Median :50.35 | Median : 3061896 | Median : 1999004 | Median : 31.689 | Median : 1300299 | Median : 1.5532 | Median : 71.453 | Median : 4.6771 | Median :60.53 | Median :34.40 | Median : 5266 | Median : 3290.0 | Median : 5.600 | Median : -119592786 | Median : -458840000 | Median : -172276599 | Median : 121305000 | Median : 49615015000 | Median : 0.0000 | Median : 31.20 | Median : 7480 | Median : 900 | Median : 72.8118 | Median :12.693 | Median :68.98 | Median : 100250 | Median : 3365515 | Median : 5.295 | Median : 6.828 | Median : 5788616733 | Median : 36.20 | Median : 20.63 | Median :102.96 | Median : 18780239280 | Median : 4452322244 | Median : 20.34 | Median : 3145461613 | Median : 3356117901 | Median : 4646974810 | Median : 2604.8 | Median : 1.9900 | Median : 3.608 | Median : 11109029840 | Median : 3.126 | Median :12.072 | Median : 16.298 | Median :12.711 | Median : 4830010764 | Median : 4.8 | Median : 1000000 | Median : 0.010 | Median : 65.34 | Median : 0.088 | Median : 18.028 | Median : 2.343 | Median : 0.000 | Median : 67.32 | Median : 1.599 | Median : 55 | Median :26.70 | Median : 2.306 | Median : 9.244 | Median : 2.345 | Median :18.14 | Median : 3689 | Median : 72.856 | Median : 0 | Median : 0.2701 | Median :34.29 | Median : 2.0131 | Median : 8140 | Median :0.3707 | Median :24.12 | Median : 99.655 | |
| NA | NA | Mean :1995 | Mean : 2.648 | Mean : 54.198 | Mean : 26466700 | Mean : 26.88 | Mean :41.536 | Mean : 23.048 | Mean : 81.157 | Mean : 6.5016 | Mean : 387149 | Mean : 14914706105 | Mean : 2785468080390 | Mean : 2980869017620 | Mean :71.795 | Mean :62.219 | Mean :51.33 | Mean : 29028656406 | Mean : 30179405859 | Mean : 5481252 | Mean : 0.4571 | Mean :45.80 | Mean : 30201302 | Mean :30.318 | Mean : 29.93 | Mean : 28.076 | Mean : 24343484422 | Mean : 23535540188 | Mean :6.155 | Mean : -1824322116 | Mean : 5287480742 | Mean : 56402276 | Mean : 31180725 | Mean :49.91 | Mean :50.09 | Mean : 30761528 | Mean : 9328817 | Mean : 34.495 | Mean : 2965607 | Mean : 1.6761 | Mean : 365.311 | Mean : 6.8307 | Mean :60.01 | Mean :33.16 | Mean : 92583 | Mean : 28317.0 | Mean : 8.913 | Mean : -409419037 | Mean : -908634940446 | Mean : -467566683 | Mean : 896634899 | Mean : 42138130034400 | Mean : 0.2629 | Mean : 45.12 | Mean : 73386 | Mean : 24281 | Mean : 67.8761 | Mean :13.249 | Mean :66.14 | Mean : 1294572 | Mean : 33196857 | Mean : 27.050 | Mean : 23.086 | Mean : 122229047620 | Mean : 43.31 | Mean : 20.92 | Mean :104.52 | Mean : 496913394315 | Mean : 72840190753 | Mean : 18.97 | Mean : 125588763362 | Mean : 106020810582 | Mean : 105299612634 | Mean : 9998.5 | Mean : 1.7475 | Mean : 3.439 | Mean : 426487447392 | Mean : 16.013 | Mean :13.614 | Mean : 27.288 | Mean :14.166 | Mean : 124664660105 | Mean : 145.8 | Mean : 4688399069 | Mean : 2.306 | Mean : 59.27 | Mean :16.145 | Mean : 32.431 | Mean : 17.886 | Mean : 4.937 | Mean : 75.38 | Mean : 14.240 | Mean : 106203 | Mean :29.86 | Mean : 2.329 | Mean :10.819 | Mean : 4.787 | Mean :19.83 | Mean : 99512 | Mean : 68.350 | Mean : 47892 | Mean : 11.5945 | Mean :34.68 | Mean : 4.7991 | Mean : 273387 | Mean :0.5263 | Mean :26.47 | Mean : 81.593 | |
| NA | NA | 3rd Qu.:2008 | 3rd Qu.: 3.972 | 3rd Qu.: 74.216 | 3rd Qu.: 8198393 | 3rd Qu.: 37.37 | 3rd Qu.:54.216 | 3rd Qu.: 26.487 | 3rd Qu.:100.452 | 3rd Qu.: 8.0866 | 3rd Qu.: 102256 | 3rd Qu.: 6139212749 | 3rd Qu.: 101718788500 | 3rd Qu.: 246596317750 | 3rd Qu.:84.619 | 3rd Qu.:73.996 | 3rd Qu.:59.91 | 3rd Qu.: 6856026932 | 3rd Qu.: 6663954605 | 3rd Qu.: 1363938 | 3rd Qu.: 1.8501 | 3rd Qu.:66.27 | 3rd Qu.: 8248653 | 3rd Qu.:52.394 | 3rd Qu.: 56.99 | 3rd Qu.: 35.381 | 3rd Qu.: 4354306253 | 3rd Qu.: 2024107348 | 3rd Qu.:7.000 | 3rd Qu.: 28504340 | 3rd Qu.: 53856043 | 3rd Qu.: 16543472 | 3rd Qu.: 9844537 | 3rd Qu.:50.35 | 3rd Qu.:51.09 | 3rd Qu.: 9836732 | 3rd Qu.: 6761455 | 3rd Qu.: 43.737 | 3rd Qu.: 3030611 | 3rd Qu.: 2.6003 | 3rd Qu.: 169.919 | 3rd Qu.: 9.9226 | 3rd Qu.:66.06 | 3rd Qu.:43.29 | 3rd Qu.: 38411 | 3rd Qu.: 10980.0 | 3rd Qu.: 9.968 | 3rd Qu.: -25619 | 3rd Qu.: 0 | 3rd Qu.: -4510681 | 3rd Qu.: 394237495 | 3rd Qu.: 639905504977 | 3rd Qu.: 0.0717 | 3rd Qu.: 67.38 | 3rd Qu.: 26628 | 3rd Qu.: 5321 | 3rd Qu.: 84.5323 | 3rd Qu.:17.586 | 3rd Qu.:73.98 | 3rd Qu.: 472710 | 3rd Qu.: 10295119 | 3rd Qu.: 11.047 | 3rd Qu.: 41.435 | 3rd Qu.: 31047568760 | 3rd Qu.: 54.60 | 3rd Qu.: 26.72 | 3rd Qu.:110.22 | 3rd Qu.: 109114709491 | 3rd Qu.: 32636282215 | 3rd Qu.: 27.57 | 3rd Qu.: 28533420208 | 3rd Qu.: 25108000000 | 3rd Qu.: 25565975639 | 3rd Qu.: 10402.0 | 3rd Qu.: 4.3246 | 3rd Qu.: 6.009 | 3rd Qu.: 72060508273 | 3rd Qu.: 14.523 | 3rd Qu.:18.441 | 3rd Qu.: 43.011 | 3rd Qu.:18.043 | 3rd Qu.: 32174092994 | 3rd Qu.: 10.7 | 3rd Qu.: 452500000 | 3rd Qu.: 1.528 | 3rd Qu.: 92.00 | 3rd Qu.:26.107 | 3rd Qu.: 60.488 | 3rd Qu.: 24.422 | 3rd Qu.: 0.000 | 3rd Qu.: 100.00 | 3rd Qu.: 21.823 | 3rd Qu.: 6300 | 3rd Qu.:37.93 | 3rd Qu.: 2.861 | 3rd Qu.:15.143 | 3rd Qu.: 5.106 | 3rd Qu.:25.67 | 3rd Qu.: 27396 | 3rd Qu.: 94.731 | 3rd Qu.: 7811 | 3rd Qu.: 16.8106 | 3rd Qu.:46.99 | 3rd Qu.: 6.3299 | 3rd Qu.: 56975 | 3rd Qu.:0.6085 | 3rd Qu.:37.39 | 3rd Qu.:100.000 | |
| NA | NA | Max. :2020 | Max. : 48.936 | Max. :100.000 | Max. :4352232429 | Max. : 100.00 | Max. :98.467 | Max. :304.276 | Max. :860.800 | Max. :87.5074 | Max. :45873850 | Max. :774147989000 | Max. : 651107600000000 | Max. :450281900000000 | Max. :96.093 | Max. :92.978 | Max. :96.20 | Max. :5884869109190 | Max. :6246125540220 | Max. :601000000 | Max. : 29.6283 | Max. :97.16 | Max. :3398794081 | Max. :98.343 | Max. :100.00 | Max. :100.236 | Max. :4858648262610 | Max. :4790066687040 | Max. :8.000 | Max. : 282689352952 | Max. :1257803920570 | Max. :7752840547 | Max. :3907216408 | Max. :76.71 | Max. :55.63 | Max. :3842820324 | Max. :409712858 | Max. :100.000 | Max. :37468302 | Max. : 17.6334 | Max. :21388.600 | Max. :28.3973 | Max. :86.40 | Max. :51.57 | Max. :12493789 | Max. :2986520.0 | Max. :192.227 | Max. :292301000000 | Max. : 105131000000000 | Max. : 257794000000 | Max. :167800328125 | Max. :10211700000000000 | Max. :22.4135 | Max. :219.30 | Max. :8174420 | Max. :3187680 | Max. :100.0000 | Max. :50.037 | Max. :85.42 | Max. :129956634 | Max. :3467973718 | Max. :23773.132 | Max. :100.000 | Max. :24723587089500 | Max. :427.58 | Max. : 100.67 | Max. :261.43 | Max. :87149338258100 | Max. :6256953481220 | Max. : 88.39 | Max. :23478971753200 | Max. :19262553026400 | Max. :19006596990600 | Max. :190512.7 | Max. :140.3670 | Max. :149.973 | Max. :87607773878100 | Max. :359.256 | Max. :94.057 | Max. :354.553 | Max. :62.416 | Max. :25247985795000 | Max. :844788.2 | Max. :1644540000000 | Max. :65.444 | Max. :100.00 | Max. :99.795 | Max. :100.000 | Max. :100.000 | Max. :87.986 | Max. :20422.89 | Max. :216.648 | Max. :15291329 | Max. :96.97 | Max. :103.158 | Max. :48.431 | Max. :86.957 | Max. :81.25 | Max. :10482498 | Max. :258.524 | Max. :7056781 | Max. :207.3675 | Max. :90.38 | Max. :360.8532 | Max. :34041046 | Max. :5.3510 | Max. :56.95 | Max. :100.000 | |
| NA | NA | NA | NA’s :85 | NA’s :60 | NA’s :83 | NA’s :3971 | NA’s :3819 | NA’s :3969 | NA’s :2895 | NA’s :1978 | NA’s :1542 | NA’s :3786 | NA’s :3742 | NA’s :4515 | NA’s :1101 | NA’s :1101 | NA’s :3731 | NA’s :3728 | NA’s :3726 | NA’s :3845 | NA’s :462 | NA’s :60 | NA’s :83 | NA’s :4604 | NA’s :5021 | NA’s :4571 | NA’s :3746 | NA’s :3752 | NA’s :527 | NA’s :4102 | NA’s :4541 | NA’s :32 | NA’s :950 | NA’s :927 | NA’s :927 | NA’s :950 | NA’s :4233 | NA’s :2726 | NA’s :2754 | NA’s :35 | NA’s :139 | NA’s :927 | NA’s :927 | NA’s :927 | NA’s :1948 | NA’s :1340 | NA’s :3186 | NA’s :2661 | NA’s :2622 | NA’s :3771 | NA’s :3713 | NA’s :3289 | NA’s :2618 | NA’s :1677 | NA’s :1360 | NA’s :1098 | NA’s :2198 | NA’s :3768 | NA’s :1015 | NA’s :116 | NA’s :4798 | NA’s :3295 | NA’s :4639 | NA’s :2874 | NA’s :2894 | NA’s :4765 | NA’s :3374 | NA’s :3309 | NA’s :4782 | NA’s :3230 | NA’s :3264 | NA’s :3730 | NA’s :3727 | NA’s :1835 | NA’s :2077 | NA’s :2074 | NA’s :1832 | NA’s :4516 | NA’s :4134 | NA’s :4154 | NA’s :4126 | NA’s :2875 | NA’s :4224 | NA’s :4668 | NA’s :4671 | NA’s :4671 | NA’s :4671 | NA’s :4671 | NA’s :4671 | NA’s :4772 | NA’s :3236 | NA’s :2433 | NA’s :2062 | NA’s :4775 | NA’s :4795 | NA’s :4775 | NA’s :4775 | NA’s :4775 | NA’s :2062 | NA’s :2433 | NA’s :2062 | NA’s :2433 | NA’s :4775 | NA’s :1963 | NA’s :1960 | NA’s :3046 | NA’s :808 | NA’s :5063 |
Podsumowanie GoldPrices
knitr::kable(summary(goldPricesYearly))
| year | gold_usd | gold_gbp | gold_euro | |
|---|---|---|---|---|
| Length:54 | Min. : 35.96 | Min. : 15.01 | Min. : 261.6 | |
| Class :character | 1st Qu.: 283.00 | 1st Qu.: 179.26 | 1st Qu.: 344.1 | |
| Mode :character | Median : 382.50 | Median : 241.59 | Median : 926.3 | |
| NA | Mean : 580.96 | Mean : 374.95 | Mean : 805.1 | |
| NA | 3rd Qu.: 828.39 | 3rd Qu.: 441.39 | 3rd Qu.:1121.5 | |
| NA | Max. :1801.00 | Max. :1379.37 | Max. :1549.5 | |
| NA | NA | NA | NA’s :31 |
Podsumowanie SpComposite
knitr::kable(summary(spCompositeYearly))
| year | spComposite | dividend | earnings | cpi | longInterestRate | realPrice | realDividend | realEarnings | cyclicallyAdjustedPERattio | |
|---|---|---|---|---|---|---|---|---|---|---|
| Length:151 | Min. : 3.136 | Min. : 0.1800 | Min. : 0.2058 | Min. : 6.462 | Min. : 0.8942 | Min. : 84.79 | Min. : 5.728 | Min. : 7.871 | Min. : 5.311 | |
| Class :character | 1st Qu.: 7.894 | 1st Qu.: 0.4217 | 1st Qu.: 0.5704 | 1st Qu.: 10.212 | 1st Qu.: 3.2185 | 1st Qu.: 186.28 | 1st Qu.: 9.365 | 1st Qu.: 14.529 | 1st Qu.:12.003 | |
| Mode :character | Median : 17.081 | Median : 0.8933 | Median : 1.4217 | Median : 20.042 | Median : 3.8196 | Median : 281.08 | Median :14.331 | Median : 22.892 | Median :16.457 | |
| NA | Mean : 332.147 | Mean : 6.9012 | Mean : 15.7599 | Mean : 62.619 | Mean : 4.5006 | Mean : 625.91 | Mean :17.637 | Mean : 35.241 | Mean :17.237 | |
| NA | 3rd Qu.: 160.446 | 3rd Qu.: 7.1400 | 3rd Qu.: 14.9679 | 3rd Qu.:101.742 | 3rd Qu.: 5.0492 | 3rd Qu.: 711.64 | 3rd Qu.:22.489 | 3rd Qu.: 43.987 | 3rd Qu.:20.774 | |
| NA | Max. :4114.705 | Max. :59.0941 | Max. :134.9175 | Max. :267.817 | Max. :13.9108 | Max. :4172.50 | Max. :62.339 | Max. :144.072 | Max. :42.068 | |
| NA | NA | NA | NA | NA | NA | NA | NA | NA | NA’s :10 |
Podsumowanie CurrencyExchangeRates
knitr::kable(summary(currencyExchangeRates))
| Date | Algerian.Dinar | Australian.Dollar | Bahrain.Dinar | Bolivar.Fuerte | Botswana.Pula | Brazilian.Real | Brunei.Dollar | Canadian.Dollar | Chilean.Peso | Chinese.Yuan | Colombian.Peso | Czech.Koruna | Danish.Krone | Euro | Hungarian.Forint | Icelandic.Krona | Indian.Rupee | Indonesian.Rupiah | Iranian.Rial | Israeli.New.Sheqel | Japanese.Yen | Kazakhstani.Tenge | Korean.Won | Kuwaiti.Dinar | Libyan.Dinar | Malaysian.Ringgit | Mauritian.Rupee | Mexican.Peso | Nepalese.Rupee | New.Zealand.Dollar | Norwegian.Krone | Nuevo.Sol | Pakistani.Rupee | Peso.Uruguayo | Philippine.Peso | Polish.Zloty | Qatar.Riyal | Rial.Omani | Russian.Ruble | Saudi.Arabian.Riyal | Singapore.Dollar | South.African.Rand | Sri.Lanka.Rupee | Swedish.Krona | Swiss.Franc | Thai.Baht | Trinidad.And.Tobago.Dollar | Tunisian.Dinar | U.A.E..Dirham | U.K..Pound.Sterling | U.S..Dollar | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Length:5978 | Min. : 71.29 | Min. :0.4833 | Min. :0.376 | Min. : 2.14 | Min. :0.0855 | Min. :0.832 | Min. :1.000 | Min. :0.917 | Min. :377.5 | Min. :6.093 | Min. : 833.2 | Min. :14.45 | Min. :4.665 | Min. :0.8252 | Min. :144.1 | Min. : 54.72 | Min. :31.37 | Min. : 2201 | Min. : 1699 | Min. :3.230 | Min. : 75.86 | Min. :117.2 | Min. : 756 | Min. :0.2646 | Min. :0.525 | Min. :2.436 | Min. :25.15 | Min. : 5.915 | Min. : 49.88 | Min. :0.3927 | Min. :4.959 | Min. :2.539 | Min. : 30.88 | Min. : 9.32 | Min. :24.55 | Min. :2.022 | Min. :3.64 | Min. :0.3845 | Min. :23.13 | Min. :3.745 | Min. :1.201 | Min. : 3.530 | Min. : 49.57 | Min. : 5.843 | Min. :0.7253 | Min. :24.44 | Min. :5.839 | Min. :1.342 | Min. :3.671 | Min. :1.213 | Min. :1 | |
| Class :character | 1st Qu.: 77.50 | 1st Qu.:0.6654 | 1st Qu.:0.376 | 1st Qu.: 2.59 | 1st Qu.:0.1197 | 1st Qu.:1.709 | 1st Qu.:1.348 | 1st Qu.:1.086 | 1st Qu.:503.5 | 1st Qu.:6.495 | 1st Qu.:1786.0 | 1st Qu.:19.35 | 1st Qu.:5.612 | 1st Qu.:1.0889 | 1st Qu.:202.7 | 1st Qu.: 70.28 | 1st Qu.:42.82 | 1st Qu.: 8855 | 1st Qu.: 1755 | 1st Qu.:3.676 | 1st Qu.:100.70 | 1st Qu.:145.4 | 1st Qu.:1013 | 1st Qu.:0.2854 | 1st Qu.:0.662 | 1st Qu.:3.188 | 1st Qu.:29.12 | 1st Qu.:10.953 | 1st Qu.: 68.33 | 1st Qu.:0.5813 | 1st Qu.:6.104 | 1st Qu.:2.755 | 1st Qu.: 51.79 | 1st Qu.:20.07 | 1st Qu.:43.18 | 1st Qu.:3.033 | 1st Qu.:3.64 | 1st Qu.:0.3845 | 1st Qu.:28.27 | 1st Qu.:3.745 | 1st Qu.:1.361 | 1st Qu.: 6.213 | 1st Qu.: 77.54 | 1st Qu.: 6.838 | 1st Qu.:0.9777 | 1st Qu.:31.50 | 1st Qu.:6.260 | 1st Qu.:1.566 | 1st Qu.:3.672 | 1st Qu.:1.519 | 1st Qu.:1 | |
| Mode :character | Median : 81.28 | Median :0.7595 | Median :0.376 | Median : 6.28 | Median :0.1528 | Median :2.048 | Median :1.468 | Median :1.297 | Median :538.6 | Median :6.989 | Median :2017.6 | Median :21.88 | Median :6.051 | Median :1.2295 | Median :224.3 | Median : 83.48 | Median :45.92 | Median : 9260 | Median : 8992 | Median :3.882 | Median :109.39 | Median :150.3 | Median :1122 | Median :0.2947 | Median :1.932 | Median :3.676 | Median :30.67 | Median :12.680 | Median : 74.04 | Median :0.6844 | Median :6.709 | Median :2.819 | Median : 60.75 | Median :22.94 | Median :44.40 | Median :3.290 | Median :3.64 | Median :0.3845 | Median :30.54 | Median :3.750 | Median :1.444 | Median : 7.480 | Median :103.99 | Median : 7.618 | Median :1.1878 | Median :34.65 | Median :6.282 | Median :1.723 | Median :3.672 | Median :1.599 | Median :1 | |
| NA | Mean : 90.59 | Mean :0.7683 | Mean :0.376 | Mean : 835.09 | Mean :0.1965 | Mean :2.161 | Mean :1.508 | Mean :1.268 | Mean :561.8 | Mean :7.316 | Mean :2073.1 | Mean :22.95 | Mean :6.281 | Mean :1.2076 | Mean :231.1 | Mean : 92.46 | Mean :48.02 | Mean : 9144 | Mean :10718 | Mean :4.003 | Mean :107.97 | Mean :185.6 | Mean :1100 | Mean :0.2936 | Mean :1.510 | Mean :3.508 | Mean :31.03 | Mean :13.116 | Mean : 77.37 | Mean :0.6606 | Mean :6.965 | Mean :2.960 | Mean : 70.24 | Mean :24.11 | Mean :45.01 | Mean :3.365 | Mean :3.64 | Mean :0.3845 | Mean :36.91 | Mean :3.749 | Mean :1.503 | Mean : 8.113 | Mean :102.19 | Mean : 7.741 | Mean :1.2090 | Mean :35.14 | Mean :6.310 | Mean :1.850 | Mean :3.672 | Mean :1.615 | Mean :1 | |
| NA | 3rd Qu.:108.88 | 3rd Qu.:0.8689 | 3rd Qu.:0.376 | 3rd Qu.: 6.28 | 3rd Qu.:0.1844 | 3rd Qu.:2.794 | 3rd Qu.:1.698 | 3rd Qu.:1.409 | 3rd Qu.:619.8 | 3rd Qu.:8.277 | 3rd Qu.:2482.9 | 3rd Qu.:24.94 | 3rd Qu.:6.805 | 3rd Qu.:1.3338 | 3rd Qu.:267.6 | 3rd Qu.:117.15 | 3rd Qu.:52.33 | 3rd Qu.:11380 | 3rd Qu.:11180 | 3rd Qu.:4.370 | 3rd Qu.:118.38 | 3rd Qu.:185.7 | 3rd Qu.:1186 | 3rd Qu.:0.3027 | 3rd Qu.:1.932 | 3rd Qu.:3.800 | 3rd Qu.:32.89 | 3rd Qu.:13.668 | 3rd Qu.: 86.80 | 3rd Qu.:0.7364 | 3rd Qu.:7.806 | 3rd Qu.:3.243 | 3rd Qu.: 94.29 | 3rd Qu.:28.44 | 3rd Qu.:47.10 | 3rd Qu.:3.822 | 3rd Qu.:3.64 | 3rd Qu.:0.3845 | 3rd Qu.:36.20 | 3rd Qu.:3.750 | 3rd Qu.:1.687 | 3rd Qu.: 9.995 | 3rd Qu.:126.29 | 3rd Qu.: 8.384 | 3rd Qu.:1.3903 | 3rd Qu.:39.45 | 3rd Qu.:6.382 | 3rd Qu.:2.157 | 3rd Qu.:3.672 | 3rd Qu.:1.676 | 3rd Qu.:1 | |
| NA | Max. :115.58 | Max. :1.1055 | Max. :0.376 | Max. :68827.50 | Max. :4.8414 | Max. :4.195 | Max. :1.851 | Max. :1.613 | Max. :758.2 | Max. :8.746 | Max. :3434.9 | Max. :40.29 | Max. :9.006 | Max. :1.5990 | Max. :318.7 | Max. :147.98 | Max. :68.78 | Max. :14850 | Max. :42000 | Max. :4.994 | Max. :147.00 | Max. :383.9 | Max. :1965 | Max. :0.3089 | Max. :1.932 | Max. :4.725 | Max. :36.50 | Max. :21.908 | Max. :109.98 | Max. :0.8822 | Max. :9.606 | Max. :3.522 | Max. :115.70 | Max. :32.53 | Max. :52.35 | Max. :4.500 | Max. :3.64 | Max. :0.3845 | Max. :83.59 | Max. :3.750 | Max. :1.851 | Max. :16.771 | Max. :157.65 | Max. :10.995 | Max. :1.8228 | Max. :56.06 | Max. :6.789 | Max. :2.509 | Max. :3.675 | Max. :2.102 | Max. :1 | |
| NA | NA’s :4112 | NA’s :263 | NA’s :69 | NA’s :3664 | NA’s :1275 | NA’s :539 | NA’s :1246 | NA’s :356 | NA’s :1220 | NA’s :1316 | NA’s :582 | NA’s :1850 | NA’s :251 | NA’s :1070 | NA’s :1415 | NA’s :354 | NA’s :429 | NA’s :1492 | NA’s :1312 | NA’s :1939 | NA’s :316 | NA’s :3051 | NA’s :601 | NA’s :1054 | NA’s :123 | NA’s :301 | NA’s :2460 | NA’s :2266 | NA’s :479 | NA’s :310 | NA’s :291 | NA’s :4297 | NA’s :488 | NA’s :4287 | NA’s :4198 | NA’s :1765 | NA’s :47 | NA’s :56 | NA’s :2435 | NA’s :46 | NA’s :259 | NA’s :535 | NA’s :509 | NA’s :349 | NA’s :239 | NA’s :565 | NA’s :657 | NA’s :4258 | NA’s :71 | NA’s :122 | NA |
worldIndicatorsForWholeWorld <- worldIndicatorsComplementedDf %>%
filter(Country_Name == 'World')
goldPricesAndWorldIndicators <- merge(x=worldIndicatorsForWholeWorld[-c(1,2)], y=goldPricesYearly[c('year','gold_usd')], by='year')
goldPricesAndSpcomposite = merge(y=goldPricesYearly[c('year','gold_usd')], x=spCompositeYearly, by='year')
control <- trainControl(method="repeatedcv", number=10, repeats=5)
rfGrid <- expand.grid(mtry = 10:30)
model <- train(
gold_usd~.,
data=subset(goldPricesAndWorldIndicators, select = -year),
method="rf",
na.action = na.pass,
tuneGrid = rfGrid,
ntree = 30,
trControl=control)
importance <- arrange(varImp(model)$importance, desc(Overall))
mostImoortantIndicators_Gold <- head(importance, n=15)
knitr::kable(mostImoortantIndicators_Gold)
| Overall | |
|---|---|
Population_ages_0-14_(%_of_total_population) |
100.00000 |
Rural_population_(%_of_total_population) |
58.21818 |
GDP_per_capita_(current_US$) |
31.23685 |
Goods_imports_(BoP,_current_US$) |
27.25942 |
Imports_of_goods_and_services_(current_US$) |
25.80833 |
Population,_total |
21.02249 |
Population,_male |
18.28670 |
Population,_male_(%_of_total_population) |
18.12738 |
GDP_(current_US$) |
16.98931 |
Population_growth_(annual_%) |
16.45479 |
Population_in_the_largest_city_(%_of_urban_population) |
14.80549 |
Labor_force,_total |
14.59779 |
| CO2_emissions_from_other_sectors | 14.38574 |
Pupil-teacher_ratio,_primary |
13.56321 |
Trade_in_services_(%_of_GDP) |
13.53011 |
names <- c(rownames(mostImoortantIndicators_Gold), 'year')
names <- gsub("`", "", all_of(names))
dataForCorrelation <- merge(worldIndicatorsForWholeWorld[names], goldPricesAndSpcomposite, by='year')
res <- cor(dataForCorrelation)
heatmaply_cor(
res,
xlab = "Features",
ylab = "Features",
k_col = 2,
k_row = 2
)
res <- cor(worldIndicatorsComplementedDf[names])
heatmaply_cor(
res,
xlab = "Features",
ylab = "Features",
k_col = 2,
k_row = 2
)
g <- ggplot(
goldPricesYearly,
aes(x=year,
y=gold_usd,
group=1)
) +
scale_x_discrete(limits=goldPricesYearly$year,breaks=goldPricesYearly$year[seq(1,length(goldPricesYearly$year),by=5)]) +
geom_line()
ggplotly(g)
g <- ggplot(
goldPricesAndWorldIndicators,
aes(x=`CO2_emissions_residential_buildings_and_services`,
y=gold_usd,
group=1)
) +
geom_line()
ggplotly(g)
g <- ggplot(
goldPricesAndWorldIndicators,
aes(x=`Birth_rate,_crude_(per_1,000_people)`,
y=gold_usd,
group=1)
) +
geom_line()
ggplotly(g)
g <- ggplot(
goldPricesAndWorldIndicators,
aes(x=Rural_population,
y=gold_usd,
group=1)
) +
geom_line()
ggplotly(g)
g <- ggplot(
goldPricesAndWorldIndicators,
aes(x=`GDP_(current_US$)`,
y=gold_usd,
group=1)
) +
geom_line()
ggplotly(g)
g <- ggplot(
spCompositeYearly,
aes(x=year,
y=spComposite,
group=1)
) +
geom_line()
ggplotly(g)
cleanedWorldDevelopmentIndicatorsResultWithoutWorld <- cleanedWorldDevelopmentIndicatorsResult %>%
filter(Country_Name != 'World')
max_gdp_country = max(cleanedWorldDevelopmentIndicatorsResultWithoutWorld$`GDP_(current_US$)`, na.rm = TRUE)
scaleFactor <- max_gdp_country / max(cleanedWorldDevelopmentIndicatorsResultWithoutWorld$`GDP_per_capita_(current_US$)`, na.rm = TRUE)
g <- ggplot(
cleanedWorldDevelopmentIndicatorsResultWithoutWorld,
aes(x=year)
) +
geom_smooth(aes(y=`GDP_(current_US$)`), method="loess", col="blue") +
geom_smooth(aes(y=`GDP_per_capita_(current_US$)` * scaleFactor), method="loess", col="red") +
scale_y_continuous(name="GDP(current US$)", sec.axis=sec_axis(~./scaleFactor, name="GDP per capita(current US$)")) +
theme(
axis.title.y.left=element_text(color="blue"),
axis.text.y.left=element_text(color="blue"),
axis.title.y.right=element_text(color="red"),
axis.text.y.right=element_text(color="red")
) +
facet_wrap(vars(Country_Name), ncol = 4)
ggplotly(g)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1832 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1835 rows containing non-finite values (stat_smooth).